<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../css/style.css" />
<link href="../assets/css/codemirror.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/css/ace.min.css" />
<link rel="stylesheet" href="../font/css/font-awesome.min.css" />
<link href="../css/layui.css" type="text/css" rel="stylesheet" />

<script src="../js/jquery-1.9.1.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/typeahead-bs2.min.js"></script>
<script src="../assets/js/jquery.dataTables.min.js"></script>
<script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
<script src="../assets/layer/layer.js" type="text/javascript"></script>
<script src="../assets/laydate/laydate.js" type="text/javascript"></script>
<script type="text/javascript">
	/* 鼠标特效 */
	var a_idx = 0;
	jQuery(document).ready(function($) {
		$("body").click(function(e) {
		 var a = new Array( "富强", "民主","文明", "和谐", "自由", "平等","公正", "法治", "爱国", "敬业","诚信", "友善");
		 var $i = $("<span/>").text(a[a_idx]);a_idx = (a_idx + 1) % a.length;
		 var x = e.pageX, y = e.pageY;
			 $i.css({
					 "z-index" : 999999999999999999999999999999999999999999999999999999999999999999999,
					 "top" : y - 20,
					 "left" : x,
					 "position" : "absolute",
					 "font-weight" : "bold",
					 "color" : "#6840bf"
					});
					 $("body").append($i);
					 $i.animate({
						"top" : y - 180,
						"opacity" : 0
						}, 1500, function() {
						 $i.remove();
				  });
		});
	});
</script>

<script>


        $(function(){
            $(".pimg").click(function(){
                var _this = $(this);//将当前的pimg元素作为_this传入函数
                imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
            });
        });

        function imgShow(outerdiv, innerdiv, bigimg, _this){
            var src = _this.attr("src");//获取当前点击的pimg元素中的src属性
            $(bigimg).attr("src", src);//设置#bigimg元素的src属性

            /*获取当前点击图片的真实大小，并显示弹出层及大图*/
            $("<img/>").attr("src", src).load(function(){
                var windowW = $(window).width();//获取当前窗口宽度
                var windowH = $(window).height();//获取当前窗口高度
                var realWidth = this.width;//获取图片真实宽度
                var realHeight = this.height;//获取图片真实高度
                var imgWidth, imgHeight;
                var scale = 0.8;//缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放

                if(realHeight>windowH*scale) {//判断图片高度
                    imgHeight = windowH*scale;//如大于窗口高度，图片高度进行缩放
                    imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度
                    if(imgWidth>windowW*scale) {//如宽度扔大于窗口宽度
                        imgWidth = windowW*scale;//再对宽度进行缩放
                    }
                } else if(realWidth>windowW*scale) {//如图片高度合适，判断图片宽度
                    imgWidth = windowW*scale;//如大于窗口宽度，图片宽度进行缩放
                    imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度
                } else {//如果图片真实高度和宽度都符合要求，高宽不变
                    imgWidth = realWidth;
                    imgHeight = realHeight;
                }
                $(bigimg).css("width",imgWidth);//以最终的宽度对图片缩放

                var w = (windowW-imgWidth)/2;//计算图片与窗口左边距
                var h = (windowH-imgHeight)/2;//计算图片与窗口上边距
                $(innerdiv).css({"top":h, "left":w});//设置#innerdiv的top和left属性
                $(outerdiv).fadeIn("fast");//淡入显示#outerdiv及.pimg
            });

            $(outerdiv).click(function(){//再次点击淡出消失弹出层
                $(this).fadeOut("fast");
            });
        }

    </script>

<title>评论</title>
</head>

<body>

	<div class="margin clearfix">
		<div class="Guestbook_style">

			<div class="Guestbook_list">
				<table class="table table-striped table-bordered table-hover"
					id="sample-table">
					<thead>
						<tr>
							<th width="80">ID</th>
							<td width="100">姓名</td>
							<th width="150px">密码</th>
							<th width="100px">电话</th>
							<th width="100px">邮箱</th>
							<th width="230px">余额</th>
							<th width="230px">偏好</th>
							<th width="100px">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${customerlist }" var="item">
							<tr>
								<td>${item.id }</td>
								<td>${item.cname }</td>
								<td class="text-l">${item.cpwd }</td>
								<td class="text-l">${item.ctel }</td>
								<td>${item.cemail }</td>
								<td>${item.money }</td>
								<td>${item.pianhao }</td>
								<td class="td-manage">
									<a title="删除" href="javascript:;"
									onclick="member_del(this,${item.id});"
									class="btn btn-xs btn-warning"><img
										src="../images/delete.png" style="width: 15px; height: 15px"></img></a>

								</td>

							</tr>
						</c:forEach>


					</tbody>
				</table>
			</div>
		</div>
	</div>

</body>
</html>
<script type="text/javascript">
    /*用户-查看*/
    function member_show(title,url,id,w,h){
        layer_show(title,url+'#?='+id,w,h);
    }
   
    function member_update(obj,id){
        window.location.href='${pageContext.request.contextPath}/hCustomer/toupdateCustomer?id='+id;

    }
    
    /*产品-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $(obj).parents("tr").remove();

            window.location.href='${pageContext.request.contextPath}/hCustomer/deleteCustomer?id='+id;

            layer.msg('已删除!',{icon:1,time:1000});
            
        });
    }
    
    function member_stop(obj,id){



        layer.confirm('确认预览？',function(index){
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="已浏览"><i class="fa fa-close bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已浏览</span>');
            $(obj).remove();

            $.ajax({
                type:"GET",
                url:'${pageContext.request.contextPath}/ct/updatecomment?id='+id,
                dataType:"json",
                success:function(data){
                },

            });
            layer.msg('已浏览!',{icon: 5,time:1000});

        });
    }

    /*checkbox激发事件*/
    $('#checkbox').on('click',function(){
        if($('input[name="checkbox"]').prop("checked")){
            $('.Reply_style').css('display','block');
        }
        else{

            $('.Reply_style').css('display','none');
        }
    })
    
    
        /*添加管理员*/
    $('#administrator_add').on('click', function(){
        
        layer.open({
            type: 1,
            title:'添加理发店',
            area: ['700px',''],
            shadeClose: false,
            content: $('#add_administrator_style'),

        });
    })
    
    /*留言查看*/
    function Guestbook_iew(id){


        var index = layer.open({
            type: 1,
            title: '评论信息',
            maxmin: true,
            shadeClose:false,
            area : ['600px' , ''],
            content:$('#Guestbook'),
            btn:['确定','取消'],
            yes: function(index, layero){
                if($('input[name="checkbox"]').prop("checked")){
                    if($('.form-control').val()==""){
                        layer.alert('回复内容不能为空！',{
                            title: '提示框',
                            icon:0,
                        })
                    }else{
                        layer.alert('确定回复该内容？',{
                            title: '提示框',
                            icon:0,
                            btn:['确定','取消'],
                            yes: function(index){
                                var aa=document.getElementById("reply").value;
                                window.location.href='/ct/viewreply?id='+id+'&reply='+aa
                                layer.closeAll();
                            }
                        });
                    }
                }else{


                    layer.alert('确定回复该内容？',{
                        title: '提示框',
                        icon:0,
                        btn:['确定','取消'],
                        yes: function(index){

                            var aa= document.getElementById('toreply').value

                            window.location.href='http://127.0.0.1:8080/tfood/hcomment/viewreply?id='+id+'&reply='+aa
                            layer.closeAll();
                        }
                    });
                }
            }
        })
    };
    /*字数限制*/
    function checkLength(which) {
        var maxChars = 200; //
        if(which.value.length > maxChars){
            layer.open({
                icon:2,
                title:'提示框',
                content:'您输入的字数超过限制!',
            });
            // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
            which.value = which.value.substring(0,maxChars);
            return false;
        }else{
            var curr = maxChars - which.value.length; //250 减去 当前输入的
            document.getElementById("sy").innerHTML = curr.toString();
            return true;
        }
    };
</script>
<script type="text/javascript">
    $(function() {
        var oTable1 = $('#sample-table').dataTable( {
            "aaSorting": [],//默认第几个排序
            "bStateSave": false,//状态保存
            //"dom": 't',
            "bFilter":false,
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,1,2,3,4]}// 制定列不参与排序
            ] } );
        $('table th input:checkbox').on('click' , function(){
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function(){
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });
    })
</script>
